package com.tzy.spi.extend;

import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@EnableAspectJAutoProxy

public class SpringSpiExtension implements SpiExtension , BeanPostProcessor {

    private static ApplicationContext context;

    @Override
    public <T> T getExtendBean(ExtendObj extendObj, Class<T> type) {
        if(context!=null){
            return context.getBean(type);
        }
        return null;
    }


    public static void setApplicationContext(ApplicationContext context){
        SpringSpiExtension.context=context;
    }

}
